﻿using DotNet.Utilities;
using JinfuyuanProject.Entity.Filter;
using JinfuyuanProject.Service.Interface;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace JinfuyuanProject.Controllers
{
    //彭煦东 业务经理页面
    public class ManagerController : Controller
    {
        private readonly IManagerService _managerService;
        private readonly ManagerFilter _filter;

        public ManagerController(IManagerService managerService, ManagerFilter filter)
        {
            _managerService = managerService;
            _filter = filter;
            // 这里可以添加一些初始化代码，例如依赖注入等
        }
        // GET: Manager
        #region 页面
        public ActionResult Index()
        {
            // 这里可以添加一些逻辑来处理请求，例如从数据库获取数据等
            return View();
        }
        public ActionResult Analyse(string data)
        {
                ViewBag.data = data;
            return View();
        }
        public ActionResult AllAnalyse()
        {
            return View();
        }
        #endregion
        #region 接口
        public JsonResult DataList(string name, string phone, int page, int limit)
        {

            _filter.Name = name;
            _filter.Phone = phone;
            _filter.page = page;
            _filter.limit = limit;
            ResMessage resMessage = _managerService.Query(_filter);
            resMessage.code = 0;

            return Json(resMessage, JsonRequestBehavior.AllowGet);
        }
        public JsonResult SingleData(string data)
        {

            // data = data.Replace("&quot;", "\"");
            //data = data.Trim('"');
            return Json(_managerService.GetData(data), JsonRequestBehavior.AllowGet);
        }
        #endregion
    }
}